//
//  OMOrderButtonAdapter.m
//  OMENGO_NEW
//
//  Created by 梁尚嘉 on 2017/5/15.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMOrderButtonAdapter.h"

@implementation OMOrderButtonTitle

@end


@implementation OMOrderButtonAdapter
+ (NSArray <OMOrderButtonTitle *>*)buttonTitlesWithStatus:(OrderStatus)status
                                               showInList:(BOOL)boolean
{
   return
    [OMOrderButtonTitle mj_objectArrayWithKeyValuesArray:
    boolean ?
        [self listButtonTitlesWithStatus:status]
    :   [self detailButtonTitlesWithStatus:status]];
}

+ (NSArray *)listButtonTitlesWithStatus:(OrderStatus)status
{
    switch (status) {
        case pendingPayment:return
            @[
              @{@"desc":@"去支付",@"isFullFill":@(YES)},
              ];
        case pendingReview:return
            @[
              ];
        case pendingShipment:return
            @[
              ];
        case shipped:return
            @[
              @{@"desc":@"确认收货",@"isFullFill":@(YES)},
              ];
        case received:
        case completed:return
            @[
              @{@"desc":@"评价",@"isFullFill":@(YES)},
              @{@"desc":@"删除订单",@"isFullFill":@(NO)},
              ];
        case failed:
        case canceled:
        case denied:
        case allCanceled:
        case unfinished:return
            @[
              @{@"desc":@"删除订单",@"isFullFill":@(NO)},
              ];
        case refunded:return
            @[
              @{@"desc":@"查看退款",@"isFullFill":@(YES)},
              @{@"desc":@"删除订单",@"isFullFill":@(NO)},
              ];
        case refunding:return
            @[
              @{@"desc":@"查看退款",@"isFullFill":@(YES)},
              ];
        case reviewed:return
            @[
              @{@"desc":@"查看评价",@"isFullFill":@(YES)},
              @{@"desc":@"删除订单",@"isFullFill":@(NO)},
              ];
    }
    return nil;
}

+ (NSArray *)detailButtonTitlesWithStatus:(OrderStatus)status
{
    switch (status) {
        case pendingPayment:return
            @[
              @{@"desc":@"去支付",@"isFullFill":@(NO)},
              @{@"desc":@"取消订单",@"isFullFill":@(NO)},
              ];
        case pendingReview:return
            @[
              @{@"desc":@"取消订单",@"isFullFill":@(YES)},
              ];
        case pendingShipment:return
            @[
              @{@"desc":@"申请退款",@"isFullFill":@(YES)},
              ];
        case shipped:return
            @[
                @{@"desc":@"确认收货",@"isFullFill":@(YES)},
              ];
        case received:
        case completed:return
            @[
                @{@"desc":@"评价",@"isFullFill":@(YES)},
                @{@"desc":@"意见反馈",@"isFullFill":@(NO)},
              ];
        case failed:
        case canceled:
        case denied:
        case allCanceled:
        case unfinished:return
            @[
              ];
        case refunded:return
            @[
              @{@"desc":@"查看退款",@"isFullFill":@(YES)},
              ];
        case refunding:return
            @[
              @{@"desc":@"查看退款",@"isFullFill":@(YES)},
              ];
        case reviewed:return
            @[
              @{@"desc":@"查看评价",@"isFullFill":@(YES)},
              ];
    }
    return nil;
}


@end
